//
//  HJDNewsTableViewCell.m
//  常州红房子
//
//  Created by 胡金东 on 16/7/22.
//  Copyright © 2016年 胡金东. All rights reserved.
//

#import "HJDNewsTableViewCell.h"

@implementation HJDNewsTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.image = [[UIImageView alloc]initWithFrame:CGRectZero];
        [self.image setRadius:10 borderWith:0 borderColor:nil];
        [self addSubview:self.image];
        
        self.type = [[UILabel alloc]initWithFrame:CGRectZero];
        self.type.font = [UIFont systemFontOfSize:14];
        self.type.textColor = [UIColor getColorWithHexNumber:@"BDBDBD"];
        [self addSubview:self.type];
        
        self.articleTitle = [[UILabel alloc]initWithFrame:CGRectZero];
        self.articleTitle.font = [UIFont systemFontOfSize:15];
        self.articleTitle.textColor = [UIColor getColorWithHexNumber:@"323232"];

        [self addSubview:self.articleTitle];
        
        self.shuView = [[UIView alloc]initWithFrame:CGRectZero];
        self.shuView.backgroundColor = [UIColor getColorWithHexNumber:@"5AC7AB"];
        [self.shuView setRadius:4 borderWith:0 borderColor:nil];
        [self addSubview:self.shuView];
        
        self.seeSum = [[UILabel alloc]initWithFrame:CGRectZero];
        self.seeSum.font = [UIFont systemFontOfSize:14];
        self.seeSum.textColor = [UIColor getColorWithHexNumber:@"FFFFFF"];
        self.seeSum.textAlignment = NSTextAlignmentCenter;

        [self.shuView addSubview:self.seeSum];
        
        self.seeText = [[UILabel alloc]initWithFrame:CGRectZero];
        self.seeText.font = [UIFont systemFontOfSize:14];
        self.seeText.textColor = [UIColor getColorWithHexNumber:@"848484"];
        [self addSubview:self.seeText];
        
        self.icon = [[UIImageView alloc]initWithFrame:CGRectZero];
        self.icon.image = [UIImage imageNamed:@"进入键"];
        [self addSubview:self.icon];
        
        self.hengView = [[UIView alloc]initWithFrame:CGRectZero];
        self.hengView.backgroundColor = [UIColor getColorWithHexNumber:@"F1F0EE"];
        [self addSubview:self.hengView];
        
        
    }
    return self;
}



-(void)layoutSubviews
{
    CGFloat imageX = 10;
    CGFloat imageY = 20;
    CGFloat imageW = 220/2;
    CGFloat imageH = 166/2;
    self.image.frame = CGRectMake(imageX, imageY, imageW, imageH);
    
    CGFloat sortTitleX = CGRectGetMaxX(self.image.frame)+15;
    CGFloat sortTitleY = 20;
    CGFloat sortTitleW = 150;
    CGFloat sortTitleH = 20;
    self.type.frame = CGRectMake(sortTitleX, sortTitleY, sortTitleW, sortTitleH);
    
    CGFloat articleX = sortTitleX;
    CGFloat articleY = CGRectGetMaxY(self.type.frame)+10;
    CGFloat articleW = HJDWidth -150;

    self.articleTitle.frame = CGRectMake(articleX, articleY, articleW, 20);
    
    CGFloat shuViewX = sortTitleX;
    CGFloat shuViewY = CGRectGetMaxY(self.articleTitle.frame)+10;
    CGFloat shuViewW = 50;
    CGFloat shuViewH = 25;
    self.shuView.frame = CGRectMake(shuViewX, shuViewY, shuViewW, shuViewH);
    
    CGFloat seeSumX = 0;
    CGFloat seeSumY = 2;
    CGFloat seeSumW = 50;
    CGFloat seeSumH = 20;
    self.seeSum.frame = CGRectMake(seeSumX, seeSumY, seeSumW, seeSumH);
    
    CGFloat seeTextX = CGRectGetMaxX(self.shuView.frame)+ 10;
    CGFloat seeTextY = shuViewY;
    CGFloat seeTextW = 58;
    CGFloat seeTextH = 25;
    self.seeText.frame = CGRectMake(seeTextX, seeTextY, seeTextW, seeTextH);
    
    CGFloat iconX = CGRectGetMaxX(self.seeText.frame)+2;
    CGFloat iconY = shuViewY+9;
    CGFloat iconW = 9;
    CGFloat iconH = 9;
    self.icon.frame = CGRectMake(iconX, iconY,iconW, iconH);
    
    CGFloat hengViewX = sortTitleX;
    CGFloat hengViewY = CGRectGetMaxY(self.shuView.frame)+15;
    CGFloat hengViewW = articleW;
    CGFloat hengViewH = 1;
    self.hengView.frame = CGRectMake(hengViewX, hengViewY, hengViewW, hengViewH);
    
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
